<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>mechanoChemIGA: Example 7 : Unconditionally stable scheme for mechano-chemistry</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">mechanoChemIGA
   &#160;<span id="projectnumber">0.2.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="codestructure.html"><span>Code&#160;structure</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li><a href="modules.html"><span>Functions</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="https://github.com/mechanoChem/mechanoChem"><span>GitHub&#160;code&#160;repo</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Example 7 : Unconditionally stable scheme for mechano-chemistry </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"> As in previous examples, we include the header file declaring the required user functions.</p>
<p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="user_functions_8h.html">userFunctions.h</a>&quot;</span></div>
</div><!-- fragment --></p>
<p>Then, we define initial/boundary conditions.</p>
<p><b> The <code>boundaryConditions</code> function </b></p>
<p>We apply boundary conditions so that the material is free to move in tangential directions except on z=1, where we have the free-surface condition.</p>
<p><div class="fragment"><div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gacaf804e621998c5c9794a46d3212afbb">boundaryConditions</a>(<a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a>&amp; user, <span class="keywordtype">double</span> scale){</div>
<div class="line"></div>
<div class="line">  <span class="comment">//IGASetBoundaryValue(user.iga,&quot;axis&quot;,&quot;side&quot;,&quot;dof&quot;,&quot;val&quot;)</span></div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,0,0,2,0.0); </div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,0,1,2,0.0);</div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,1,0,3,0.0); </div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,1,1,3,0.0);</div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,2,0,4,0.0);</div>
<div class="line"></div>
<div class="line">} <span class="comment">//end boundaryConditions</span></div>
</div><!-- fragment --></p>
<p><b> The <code>cmuinit</code> function and the <code>uinit</code> function </b></p>
<p>The initial conditions for the scalar and the vector fields are defined for this example problem as following.</p>
<p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">double</span> <a class="code" href="mechano_chem_stab_2user_functions_8cc.html#a19c482707eb09fb858419dc6abc2f977">cmuinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> scalar_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <span class="keywordflow">if</span> (scalar_i==0) { <span class="keywordflow">return</span> 0.48; } <span class="keywordflow">else</span> { <span class="keywordflow">return</span> 0.0; }</div>
<div class="line">}; <span class="comment">//end cmuinit</span></div>
</div><!-- fragment --></p>
<p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vector_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> tmp; </div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;dim; i++) tmp[i]=0.0;</div>
<div class="line">  <span class="keywordflow">return</span> tmp;</div>
<div class="line">}; <span class="comment">//end uinit</span></div>
</div><!-- fragment --></p>
<p><b> The <code>defineParameters</code> function </b></p>
<p>Here, we define the mesh by setting the number of elements in each direction, e.g. a 64x64x64 element mesh.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[0] = 64;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[1] = 64;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[2] = 64;</div>
</div><!-- fragment --></p>
<p>We also define the dimensions of the domain, e.g. a unit cube.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[0] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[1] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[2] = 1.;</div>
</div><!-- fragment --></p>
<p>We specify the number of vector and scalar solution and projection fields by adding the name of each field to their respective vector. Here, we have one vector solution field (the displacement) and two scalar projection field (the chemical composition and the chemical potential).</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a6794fa3a8512e9239c9f2e4c7bf18ec3">scalarSolnFields</a>.push_back(<span class="stringliteral">&quot;c&quot;</span>);</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a6794fa3a8512e9239c9f2e4c7bf18ec3">scalarSolnFields</a>.push_back(<span class="stringliteral">&quot;mu&quot;</span>);</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae171e542b477f3394601555549b7d3a8">vectorSolnFields</a>.push_back(<span class="stringliteral">&quot;displacement&quot;</span>);</div>
</div><!-- fragment --></p>
<p>We also specify the polynomial order of the basis splines and the global continuity.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a23cded74ca3d8ec2f99d69e41d8539ca">polyOrder</a> = 2;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae091f872a8ec5d2a5492586ae8fcbcbb">globalContinuity</a> = 1;</div>
</div><!-- fragment --></p>
<p>We redirect the desired user function pointers to the <code>boundaryConditions</code>, <code>cmuinit</code>, and <code>uinit</code> functions that we defined above.</p>
<p><div class="fragment"><div class="line">  user.<a class="code" href="struct_app_ctx.html#a86be433132a33a67de55e6b137326c16">boundaryConditions</a> = <a class="code" href="group__user_functions.html#gacaf804e621998c5c9794a46d3212afbb">boundaryConditions</a>;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a4a4f8fca81419b6f43a612a72ed0a989">scalarInitialConditions</a> = <a class="code" href="mechano_chem_stab_2user_functions_8cc.html#a19c482707eb09fb858419dc6abc2f977">cmuinit</a>;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a2575f8ef3d910701696ec41b0b6b2aca">vectorInitialConditions</a> = <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>;</div>
</div><!-- fragment --></p>
<p>We then define the timestep size.</p>
<p><div class="fragment"><div class="line">    user.<a class="code" href="struct_app_ctx.html#a4c155b92216444548c4457f18e050630">dtVal</a>=1.e-4;</div>
</div><!-- fragment --></p>
<p>Finally, we define various (25) material parameters that describe the mechano-chemistry.</p>
<p><div class="fragment"><div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>=(<span class="keywordtype">double</span> *) malloc(25*<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line">    <span class="comment">/* chemistry */</span></div>
<div class="line">    <span class="keywordtype">double</span> lc  = 1./8.;</div>
<div class="line"></div>
<div class="line">    <span class="comment">/* mechanics */</span></div>
<div class="line">    <span class="keywordtype">double</span> mu     = (0.0569-(-0.0583))*pow(2.0,11.0);      <span class="comment">//*0.385;</span></div>
<div class="line">    <span class="keywordtype">double</span> lambda = 1.5*mu;</div>
<div class="line">    <span class="keywordtype">double</span> c0     = 0.48;                                  <span class="comment">// initial concentration (may be with perturbation)</span></div>
<div class="line"></div>
<div class="line">    <span class="comment">/* mechanics 3-well */</span></div>
<div class="line">    <span class="keywordtype">double</span> gamma  =  pow(2.0,0.0);</div>
<div class="line">    <span class="keywordtype">double</span> rmin   =  0.25;</div>
<div class="line">    <span class="keywordtype">double</span> Wbar   = -3./4.;                                 <span class="comment">// W/(\mu\gamma rmin^4) (-1,-1/3)</span></div>
<div class="line">    <span class="keywordtype">double</span> lE     =  pow(2.0,-6.5);</div>
<div class="line">    </div>
<div class="line">    <span class="keywordtype">double</span> cstar  =  0.5;                                   <span class="comment">// critical concentration before 3-well structure</span></div>
<div class="line">    <span class="keywordtype">double</span> alpha1 =  2.*rmin*(Wbar+1.);</div>
<div class="line">    <span class="keywordtype">double</span> beta1  =  1.5*rmin*alpha1-2.0*rmin*rmin;</div>
<div class="line">    <span class="keywordtype">double</span> alpha0 = -cstar/(1-cstar)*alpha1;</div>
<div class="line">    <span class="keywordtype">double</span> beta0  = -cstar/(1-cstar)*beta1;</div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* chemistry */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[0]  = 6;                                            <span class="comment">// mobility</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[1]  = 1.0*pow(lc,2);                                <span class="comment">// diffusivity</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[2]  = 1;                                            <span class="comment">// fchem: clogc+(1-c)log(1-c)</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[3]  = 3;                                            <span class="comment">//      : c(1-c)</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[23] = 0*16*0.1;                                     <span class="comment">// -par[23]/2*(c-1/2)^2+par[23]*(c-1/2)^4: depth=-par[23]/16</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[20] = 0;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[21] = 1;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[22] = -1;</div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* mechanics */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]  = -1./16.;                                      <span class="comment">// echem               : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[5]  = -user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]*c0;                          <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[6]  = 0;                                            <span class="comment">// (e_0-e_{chem})^2    : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7]  = 1.5*lambda+mu;                                <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[14] = 0*mu;                                         <span class="comment">// (e_3^2+e_4^2+e_5^2) : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[15] = 2*mu;                                         <span class="comment">//                     : 1</span></div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* mechanics 3-well */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[8]  = mu*gamma*0;                                   <span class="comment">// (e_1^2+e_2^2)^2     : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[9]  = mu*gamma*1;                                   <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[10] = mu*gamma*(alpha1-alpha0);                     <span class="comment">// e_2*(e_2^2-3*e_1^2) : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[11] = mu*gamma*(alpha0);                            <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[12] = mu*gamma*(beta1-beta0);                       <span class="comment">// (e_1^2+e_2^2)       : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[13] = mu*gamma*(beta0);                             <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[16] = mu*gamma*pow(lE,2)*(1./2.);                   <span class="comment">// E_{IJ,K}E_{IJ,K}    : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[17] = 0;<span class="comment">//mu*gamma*pow(lE,2)*(1./2.);               //                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[18] = 0;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[19] = 0;</div>
<div class="line"></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[24] =user.<a class="code" href="struct_app_ctx.html#a4c155b92216444548c4457f18e050630">dtVal</a>;</div>
</div><!-- fragment --></p>
<p><b> The <code>residual</code> function </b></p>
<p>The residual function for an unconditionally stable second-order scheme for mechano-chemistry is used in this example.</p>
<p>We first declare <code>"eval_residual"</code> non-member function to be used in the member function, <code>"residual"</code>.</p>
<p><div class="fragment"><div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual, T *ui, <span class="keywordtype">double</span> *u0, <span class="keywordtype">double</span> *par);</div>
</div><!-- fragment --></p>
<p>The definition of the <code>eval_residual</code> function is postponed until the end of the file as it is lengthy.</p>
<p>For a complex problem like this example, where it is convenient to unfold "c.val" and "u.val", "c.grad" and "u.grad", and "c.hess" and "u.hess" and put them into a single array, ui[].</p>
<p><div class="fragment"><div class="line">  T ui[]={ c.<a class="code" href="classsolution_scalars.html#aad0d4f18ccffe03f32a1ac985eb3b3d8">val</a>(0),    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[0],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[1],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][0],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[1][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[1][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[2][2],</div>
<div class="line">           c.<a class="code" href="classsolution_scalars.html#aad0d4f18ccffe03f32a1ac985eb3b3d8">val</a>(1),    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[0],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[1],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][0],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[1][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[1][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[2][2],</div>
<div class="line">           u.val(0)[0], u.grad(0)[0][0], u.grad(0)[0][1], u.grad(0)[0][2], u.hess(0)[0][0][0], u.hess(0)[0][0][1], u.hess(0)[0][0][2], u.hess(0)[0][1][1], u.hess(0)[0][1][2], u.hess(0)[0][2][2],</div>
<div class="line">           u.val(0)[1], u.grad(0)[1][0], u.grad(0)[1][1], u.grad(0)[1][2], u.hess(0)[1][0][0], u.hess(0)[1][0][1], u.hess(0)[1][0][2], u.hess(0)[1][1][1], u.hess(0)[1][1][2], u.hess(0)[1][2][2],</div>
<div class="line">           u.val(0)[2], u.grad(0)[2][0], u.grad(0)[2][1], u.grad(0)[2][2], u.hess(0)[2][0][0], u.hess(0)[2][0][1], u.hess(0)[2][0][2], u.hess(0)[2][1][1], u.hess(0)[2][1][2], u.hess(0)[2][2][2] };</div>
</div><!-- fragment --></p>
<p>We do the same for previous solutions represented by ".valP", ".gradP", and ".hessP" as well as for the test functions "w1" and "w2" and produce arrays, u0[] and w[], respectively.</p>
<p>We then evaluate the residual vector at a given quadrature point (residual[]) using the declared function "eval_residual".</p>
<p><div class="fragment"><div class="line">  T residual[ndof*nddim];</div>
<div class="line">  <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(residual,ui,u0,user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>);</div>
</div><!-- fragment --></p>
<p>Finally, we multiply residual[] by test functions and form the integrand of the weak form at the given quadrature point.</p>
<p><div class="fragment"><div class="line">  r=0;</div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;nddim*ndof; ++i) { r+=w[i]*residual[i]; }</div>
<div class="line">  r*=dV;</div>
</div><!-- fragment --></p>
<h1>A snippet of the code </h1>
 <div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="user_functions_8h.html">userFunctions.h</a>&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gacaf804e621998c5c9794a46d3212afbb">boundaryConditions</a>(<a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a>&amp; user, <span class="keywordtype">double</span> scale){</div>
<div class="line"></div>
<div class="line">  <span class="comment">//IGASetBoundaryValue(user.iga,&quot;axis&quot;,&quot;side&quot;,&quot;dof&quot;,&quot;val&quot;)</span></div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,0,0,2,0.0); </div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,0,1,2,0.0);</div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,1,0,3,0.0); </div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,1,1,3,0.0);</div>
<div class="line">  IGASetBoundaryValue(user.<a class="code" href="struct_app_ctx.html#adfcef5b251f90ce037459e347d8f8b63">iga</a>,2,0,4,0.0);</div>
<div class="line"></div>
<div class="line">} <span class="comment">//end boundaryConditions</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">double</span> <a class="code" href="mechano_chem_stab_2user_functions_8cc.html#a19c482707eb09fb858419dc6abc2f977">cmuinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> scalar_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <span class="keywordflow">if</span> (scalar_i==0) { <span class="keywordflow">return</span> 0.48; } <span class="keywordflow">else</span> { <span class="keywordflow">return</span> 0.0; }</div>
<div class="line">}; <span class="comment">//end cmuinit</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> vector_i, <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user){</div>
<div class="line">  <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> tmp; </div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;dim; i++) tmp[i]=0.0;</div>
<div class="line">  <span class="keywordflow">return</span> tmp;</div>
<div class="line">}; <span class="comment">//end uinit</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#ga31a2f2e526abaf0b8a00c2623e14f22e">projectFields</a>(<span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;normal,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="classsolution_scalars.html">solutionScalars&lt;dim,double&gt;</a> &amp;c,</div>
<div class="line">           <span class="keyword">const</span> <a class="code" href="classsolution_vectors.html">solutionVectors&lt;dim,double&gt;</a> &amp;u,</div>
<div class="line">           <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user,</div>
<div class="line">           std::vector&lt;double&gt; &amp;scalarProjections,</div>
<div class="line">           std::vector&lt;<a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &gt; &amp;vectorProjections){</div>
<div class="line">} <span class="comment">//end projectFields</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim, <span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gadbccf6631ad847d5a681a548f921ef29">userFunctions&lt;dim,T&gt;::defineParameters</a>(<a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a>&amp; user){</div>
<div class="line"> </div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[0] = 64;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[1] = 64;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a55ccabd543df9a0223cd34dbd64c987d">N</a>[2] = 64;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[0] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[1] = 1.;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a789652912f4d6df6c0836aa22ae93de0">L</a>[2] = 1.;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a6794fa3a8512e9239c9f2e4c7bf18ec3">scalarSolnFields</a>.push_back(<span class="stringliteral">&quot;c&quot;</span>);</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a6794fa3a8512e9239c9f2e4c7bf18ec3">scalarSolnFields</a>.push_back(<span class="stringliteral">&quot;mu&quot;</span>);</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae171e542b477f3394601555549b7d3a8">vectorSolnFields</a>.push_back(<span class="stringliteral">&quot;displacement&quot;</span>);</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a23cded74ca3d8ec2f99d69e41d8539ca">polyOrder</a> = 2;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#ae091f872a8ec5d2a5492586ae8fcbcbb">globalContinuity</a> = 1;</div>
<div class="line"></div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a86be433132a33a67de55e6b137326c16">boundaryConditions</a> = <a class="code" href="group__user_functions.html#gacaf804e621998c5c9794a46d3212afbb">boundaryConditions</a>;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a4a4f8fca81419b6f43a612a72ed0a989">scalarInitialConditions</a> = <a class="code" href="mechano_chem_stab_2user_functions_8cc.html#a19c482707eb09fb858419dc6abc2f977">cmuinit</a>;</div>
<div class="line">  user.<a class="code" href="struct_app_ctx.html#a2575f8ef3d910701696ec41b0b6b2aca">vectorInitialConditions</a> = <a class="code" href="grad_elast_2user_functions_8cc.html#a6ca0a7a3f9c72487ef7525398cbaca2d">uinit</a>;</div>
<div class="line">  <span class="comment">//user.projectFields = projectFields;</span></div>
<div class="line"></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a4c155b92216444548c4457f18e050630">dtVal</a>=1.e-4;</div>
<div class="line"></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>=(<span class="keywordtype">double</span> *) malloc(25*<span class="keyword">sizeof</span>(<span class="keywordtype">double</span>));</div>
<div class="line">    <span class="comment">/* chemistry */</span></div>
<div class="line">    <span class="keywordtype">double</span> lc  = 1./8.;</div>
<div class="line"></div>
<div class="line">    <span class="comment">/* mechanics */</span></div>
<div class="line">    <span class="keywordtype">double</span> mu     = (0.0569-(-0.0583))*pow(2.0,11.0);      <span class="comment">//*0.385;</span></div>
<div class="line">    <span class="keywordtype">double</span> lambda = 1.5*mu;</div>
<div class="line">    <span class="keywordtype">double</span> c0     = 0.48;                                  <span class="comment">// initial concentration (may be with perturbation)</span></div>
<div class="line"></div>
<div class="line">    <span class="comment">/* mechanics 3-well */</span></div>
<div class="line">    <span class="keywordtype">double</span> gamma  =  pow(2.0,0.0);</div>
<div class="line">    <span class="keywordtype">double</span> rmin   =  0.25;</div>
<div class="line">    <span class="keywordtype">double</span> Wbar   = -3./4.;                                 <span class="comment">// W/(\mu\gamma rmin^4) (-1,-1/3)</span></div>
<div class="line">    <span class="keywordtype">double</span> lE     =  pow(2.0,-6.5);</div>
<div class="line">    </div>
<div class="line">    <span class="keywordtype">double</span> cstar  =  0.5;                                   <span class="comment">// critical concentration before 3-well structure</span></div>
<div class="line">    <span class="keywordtype">double</span> alpha1 =  2.*rmin*(Wbar+1.);</div>
<div class="line">    <span class="keywordtype">double</span> beta1  =  1.5*rmin*alpha1-2.0*rmin*rmin;</div>
<div class="line">    <span class="keywordtype">double</span> alpha0 = -cstar/(1-cstar)*alpha1;</div>
<div class="line">    <span class="keywordtype">double</span> beta0  = -cstar/(1-cstar)*beta1;</div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* chemistry */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[0]  = 6;                                            <span class="comment">// mobility</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[1]  = 1.0*pow(lc,2);                                <span class="comment">// diffusivity</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[2]  = 1;                                            <span class="comment">// fchem: clogc+(1-c)log(1-c)</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[3]  = 3;                                            <span class="comment">//      : c(1-c)</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[23] = 0*16*0.1;                                     <span class="comment">// -par[23]/2*(c-1/2)^2+par[23]*(c-1/2)^4: depth=-par[23]/16</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[20] = 0;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[21] = 1;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[22] = -1;</div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* mechanics */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]  = -1./16.;                                      <span class="comment">// echem               : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[5]  = -user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[4]*c0;                          <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[6]  = 0;                                            <span class="comment">// (e_0-e_{chem})^2    : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[7]  = 1.5*lambda+mu;                                <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[14] = 0*mu;                                         <span class="comment">// (e_3^2+e_4^2+e_5^2) : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[15] = 2*mu;                                         <span class="comment">//                     : 1</span></div>
<div class="line">    </div>
<div class="line">    <span class="comment">/* mechanics 3-well */</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[8]  = mu*gamma*0;                                   <span class="comment">// (e_1^2+e_2^2)^2     : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[9]  = mu*gamma*1;                                   <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[10] = mu*gamma*(alpha1-alpha0);                     <span class="comment">// e_2*(e_2^2-3*e_1^2) : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[11] = mu*gamma*(alpha0);                            <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[12] = mu*gamma*(beta1-beta0);                       <span class="comment">// (e_1^2+e_2^2)       : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[13] = mu*gamma*(beta0);                             <span class="comment">//                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[16] = mu*gamma*pow(lE,2)*(1./2.);                   <span class="comment">// E_{IJ,K}E_{IJ,K}    : c</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[17] = 0;<span class="comment">//mu*gamma*pow(lE,2)*(1./2.);               //                     : 1</span></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[18] = 0;</div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[19] = 0;</div>
<div class="line"></div>
<div class="line">    user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>[24] =user.<a class="code" href="struct_app_ctx.html#a4c155b92216444548c4457f18e050630">dtVal</a>;</div>
<div class="line"></div>
<div class="line">} <span class="comment">//end defineParameters</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual, T *ui, <span class="keywordtype">double</span> *u0, <span class="keywordtype">double</span> *par);</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dim, <span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__user_functions.html#gab9195b3f02c923dafb2c742df293db7d">userFunctions&lt;dim,T&gt;::residual</a>(<span class="keywordtype">bool</span> dV,</div>
<div class="line">                    <span class="keywordtype">bool</span> dS,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;x,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="class_tensor.html">Tensor&lt;1,dim,double&gt;</a> &amp;normal,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="classsolution_scalars.html">solutionScalars&lt;dim,T&gt;</a> &amp;c,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="classsolution_vectors.html">solutionVectors&lt;dim,T&gt;</a> &amp;u,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="classtest_function_scalars.html">testFunctionScalars&lt;dim,T&gt;</a> &amp;w1,</div>
<div class="line">                    <span class="keyword">const</span> <a class="code" href="classtest_function_vectors.html">testFunctionVectors&lt;dim,T&gt;</a> &amp;w2,</div>
<div class="line">                    <a class="code" href="struct_app_ctx.html">AppCtx&lt;dim&gt;</a> &amp;user,</div>
<div class="line">                    Sacado::Fad::SimpleFad&lt;T&gt; &amp;r){</div>
<div class="line">  </div>
<div class="line"></div>
<div class="line">  <span class="keywordtype">int</span> ndim=dim;</div>
<div class="line">  <span class="keywordtype">int</span> ndof=5;</div>
<div class="line">  <span class="keywordtype">int</span> nddim=1+ndim+ndim*(ndim+1)/2;</div>
<div class="line">  T ui[]={ c.<a class="code" href="classsolution_scalars.html#aad0d4f18ccffe03f32a1ac985eb3b3d8">val</a>(0),    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[0],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[1],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(0)[2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][0],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[0][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[1][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[1][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(0)[2][2],</div>
<div class="line">           c.<a class="code" href="classsolution_scalars.html#aad0d4f18ccffe03f32a1ac985eb3b3d8">val</a>(1),    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[0],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[1],    c.<a class="code" href="classsolution_scalars.html#a94a7f34ce00b9f6c3584756b185b320b">grad</a>(1)[2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][0],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[0][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[1][1],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[1][2],    c.<a class="code" href="classsolution_scalars.html#a782f5cb53a00a605fb80f28913f9a9b9">hess</a>(1)[2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a7f1e7d52a3f1576d85c48c37616d4459">val</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a17d562590b91ada496cca3e111777e57">grad</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#a3f9a115243164dbb8eb6e42d3791dd37">hess</a>(0)[2][2][2] };</div>
<div class="line">  <span class="keywordtype">double</span> </div>
<div class="line">    u0[]={ c.<a class="code" href="classsolution_scalars.html#aa4c4b85dc344e177b1cbeca4bd59f0e8">valP</a>(0),    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(0)[0],    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(0)[1],    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(0)[2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[0][0],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[0][1],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[0][2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[1][1],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[1][2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(0)[2][2],</div>
<div class="line">           c.<a class="code" href="classsolution_scalars.html#aa4c4b85dc344e177b1cbeca4bd59f0e8">valP</a>(1),    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(1)[0],    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(1)[1],    c.<a class="code" href="classsolution_scalars.html#a45bd5d753448bfd2a4db3691cadafaaa">gradP</a>(1)[2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[0][0],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[0][1],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[0][2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[1][1],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[1][2],    c.<a class="code" href="classsolution_scalars.html#a3eaa70630ba515b661f33cecea383395">hessP</a>(1)[2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[0][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[1][2][2],</div>
<div class="line">           u.<a class="code" href="classsolution_vectors.html#a1836cd014f8661d1227c06a11d0c062e">valP</a>(0)[2], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][0], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][1], u.<a class="code" href="classsolution_vectors.html#a5633429419dcb6392a89e7001bff00a2">gradP</a>(0)[2][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][0], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][0][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][1][1], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][1][2], u.<a class="code" href="classsolution_vectors.html#a7a6aa7c97349128a8be75e259bfb3206">hessP</a>(0)[2][2][2] };</div>
<div class="line">  Sacado::Fad::SimpleFad&lt;T&gt; </div>
<div class="line">    w[]= { w1.<a class="code" href="classtest_function_scalars.html#ad76f9644680c80e6602ccf460600b3a3">val</a>(0),    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(0)[0],    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(0)[1],    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(0)[2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[0][0],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[0][1],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[0][2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[1][1],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[1][2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(0)[2][2],</div>
<div class="line">           w1.<a class="code" href="classtest_function_scalars.html#ad76f9644680c80e6602ccf460600b3a3">val</a>(1),    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(1)[0],    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(1)[1],    w1.<a class="code" href="classtest_function_scalars.html#a40dbbf7383a6a9471d897f455405315d">grad</a>(1)[2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[0][0],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[0][1],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[0][2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[1][1],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[1][2],    w1.<a class="code" href="classtest_function_scalars.html#a6d14b4791bb5865ec406fca980225e56">hess</a>(1)[2][2],</div>
<div class="line">           w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[0][2][2],</div>
<div class="line">           w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[1][2][2],</div>
<div class="line">           w2.<a class="code" href="classtest_function_vectors.html#a2c3f7998bd59d6cc139d4e23dc711079">val</a>(0)[2], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][0], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][1], w2.<a class="code" href="classtest_function_vectors.html#ac178383f83c18393f2d61f02793fce93">grad</a>(0)[2][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][0], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][0][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][1][1], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][1][2], w2.<a class="code" href="classtest_function_vectors.html#a11dc66c53603643153b6c1bc14f716b5">hess</a>(0)[2][2][2] };</div>
<div class="line"></div>
<div class="line">  T residual[ndof*nddim];</div>
<div class="line">  <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(residual,ui,u0,user.<a class="code" href="struct_app_ctx.html#a82c1e8d8aca14b5512f031c55284da3e">par_mat</a>);</div>
<div class="line"></div>
<div class="line">  r=0;</div>
<div class="line">  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;nddim*ndof; ++i) { r+=w[i]*residual[i]; }</div>
<div class="line">  r*=dV;</div>
<div class="line">  <span class="comment">//r += -(w2.val(0)*h)*dS; //Traction</span></div>
<div class="line"></div>
<div class="line">} <span class="comment">//end residual</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><span class="keywordtype">void</span> <a class="code" href="grad_elast_2user_functions_8cc.html#aa505e1ea82a87f1e38c732d670a18e7e">eval_residual</a>(T *residual, T *ui, <span class="keywordtype">double</span> *u0, <span class="keywordtype">double</span> *par)</div>
<div class="line">{</div>
<div class="line">ui[0]=( ui[0] &gt;= 1. ?  1.-1.e-12:ui[0]);</div>
<div class="line">ui[0]=( ui[0] &lt;= 0. ?     1.e-12:ui[0]);</div>
<div class="line">T comp[9796];</div>
<div class="line">comp[0]=(-1 + pow(1 + (*(u0+21)),2) + pow((*(u0+31)),2) + pow((*(u0+41)),2))/2.;</div>
<div class="line">comp[1]=((1 + (*(u0+21)))*(*(u0+22)) + (*(u0+31))*(1 + (*(u0+32))) + (*(u0+41))*(*(u0+42)))/2.;</div>
<div class="line">comp[2]=((1 + (*(u0+21)))*(*(u0+23)) + (*(u0+31))*(*(u0+33)) + (*(u0+41))*(1 + (*(u0+43))))/2.;</div>
<div class="line">comp[3]=(-1 + pow((*(u0+22)),2) + pow(1 + (*(u0+32)),2) + pow((*(u0+42)),2))/2.;</div>
<div class="line">comp[4]=((*(u0+22))*(*(u0+23)) + (1 + (*(u0+32)))*(*(u0+33)) + (*(u0+42))*(1 + (*(u0+43))))/2.;</div>
<div class="line">comp[5]=(-1 + pow((*(u0+23)),2) + pow((*(u0+33)),2) + pow(1 + (*(u0+43)),2))/2.;</div>
<div class="line">comp[6]=(2*(1 + (*(u0+21)))*(*(u0+24)) + 2*(*(u0+31))*(*(u0+34)) + 2*(*(u0+41))*(*(u0+44)))/2.;</div>
<div class="line">comp[7]=(2*(1 + (*(u0+21)))*(*(u0+25)) + 2*(*(u0+31))*(*(u0+35)) + 2*(*(u0+41))*(*(u0+45)))/2.;</div>
<div class="line">comp[8]=(2*(1 + (*(u0+21)))*(*(u0+26)) + 2*(*(u0+31))*(*(u0+36)) + 2*(*(u0+41))*(*(u0+46)))/2.;</div>
<div class="line">comp[9]=((*(u0+22))*(*(u0+24)) + (1 + (*(u0+21)))*(*(u0+25)) + (1 + (*(u0+32)))*(*(u0+34)) + (*(u0+31))*(*(u0+35)) + (*(u0+42))*(*(u0+44)) + (*(u0+41))*(*(u0+45)))/2.;</div>
<div class="line">comp[10]=((*(u0+22))*(*(u0+25)) + (1 + (*(u0+21)))*(*(u0+27)) + (1 + (*(u0+32)))*(*(u0+35)) + (*(u0+31))*(*(u0+37)) + (*(u0+42))*(*(u0+45)) + (*(u0+41))*(*(u0+47)))/2.;</div>
<div class="line">comp[11]=((*(u0+22))*(*(u0+26)) + (1 + (*(u0+21)))*(*(u0+28)) + (1 + (*(u0+32)))*(*(u0+36)) + (*(u0+31))*(*(u0+38)) + (*(u0+42))*(*(u0+46)) + (*(u0+41))*(*(u0+48)))/2.;</div>
<div class="line">comp[12]=((*(u0+23))*(*(u0+24)) + (1 + (*(u0+21)))*(*(u0+26)) + (*(u0+33))*(*(u0+34)) + (*(u0+31))*(*(u0+36)) + (1 + (*(u0+43)))*(*(u0+44)) + (*(u0+41))*(*(u0+46)))/2.;</div>
<div class="line">comp[13]=((*(u0+23))*(*(u0+25)) + (1 + (*(u0+21)))*(*(u0+28)) + (*(u0+33))*(*(u0+35)) + (*(u0+31))*(*(u0+38)) + (1 + (*(u0+43)))*(*(u0+45)) + (*(u0+41))*(*(u0+48)))/2.;</div>
<div class="line">comp[14]=((*(u0+23))*(*(u0+26)) + (1 + (*(u0+21)))*(*(u0+29)) + (*(u0+33))*(*(u0+36)) + (*(u0+31))*(*(u0+39)) + (1 + (*(u0+43)))*(*(u0+46)) + (*(u0+41))*(*(u0+49)))/2.;</div>
<div class="line">comp[15]=(2*(*(u0+22))*(*(u0+25)) + 2*(1 + (*(u0+32)))*(*(u0+35)) + 2*(*(u0+42))*(*(u0+45)))/2.;</div>
<div class="line">comp[16]=(2*(*(u0+22))*(*(u0+27)) + 2*(1 + (*(u0+32)))*(*(u0+37)) + 2*(*(u0+42))*(*(u0+47)))/2.;</div>
<div class="line">comp[17]=(2*(*(u0+22))*(*(u0+28)) + 2*(1 + (*(u0+32)))*(*(u0+38)) + 2*(*(u0+42))*(*(u0+48)))/2.;</div>
<div class="line">comp[18]=((*(u0+23))*(*(u0+25)) + (*(u0+22))*(*(u0+26)) + (*(u0+33))*(*(u0+35)) + (1 + (*(u0+32)))*(*(u0+36)) + (1 + (*(u0+43)))*(*(u0+45)) + (*(u0+42))*(*(u0+46)))/2.;</div>
<div class="line">comp[19]=((*(u0+23))*(*(u0+27)) + (*(u0+22))*(*(u0+28)) + (*(u0+33))*(*(u0+37)) + (1 + (*(u0+32)))*(*(u0+38)) + (1 + (*(u0+43)))*(*(u0+47)) + (*(u0+42))*(*(u0+48)))/2.;</div>
<div class="line">comp[20]=((*(u0+23))*(*(u0+28)) + (*(u0+22))*(*(u0+29)) + (*(u0+33))*(*(u0+38)) + (1 + (*(u0+32)))*(*(u0+39)) + (1 + (*(u0+43)))*(*(u0+48)) + (*(u0+42))*(*(u0+49)))/2.;</div>
<div class="line">comp[21]=(2*(*(u0+23))*(*(u0+26)) + 2*(*(u0+33))*(*(u0+36)) + 2*(1 + (*(u0+43)))*(*(u0+46)))/2.;</div>
<div class="line">comp[22]=(2*(*(u0+23))*(*(u0+28)) + 2*(*(u0+33))*(*(u0+38)) + 2*(1 + (*(u0+43)))*(*(u0+48)))/2.;</div>
<div class="line">comp[23]=(2*(*(u0+23))*(*(u0+29)) + 2*(*(u0+33))*(*(u0+39)) + 2*(1 + (*(u0+43)))*(*(u0+49)))/2.;</div>
<div class="line">comp[24]=((*(comp+0)) + (*(comp+3)) + (*(comp+5)))/sqrt(3);</div>
<div class="line">comp[25]=((*(comp+6)) + (*(comp+15)) + (*(comp+21)))/sqrt(3);</div>
<div class="line">comp[26]=((*(comp+7)) + (*(comp+16)) + (*(comp+22)))/sqrt(3);</div>
<div class="line">comp[27]=((*(comp+8)) + (*(comp+17)) + (*(comp+23)))/sqrt(3);</div>
<div class="line">comp[28]=((*(comp+0)) - (*(comp+3)))/sqrt(2);</div>
<div class="line">comp[29]=((*(comp+6)) - (*(comp+15)))/sqrt(2);</div>
<div class="line">comp[30]=((*(comp+7)) - (*(comp+16)))/sqrt(2);</div>
<div class="line">comp[31]=((*(comp+8)) - (*(comp+17)))/sqrt(2);</div>
<div class="line">comp[32]=((*(comp+0)) + (*(comp+3)) - 2*(*(comp+5)))/sqrt(6);</div>
<div class="line">comp[33]=((*(comp+6)) + (*(comp+15)) - 2*(*(comp+21)))/sqrt(6);</div>
<div class="line">comp[34]=((*(comp+7)) + (*(comp+16)) - 2*(*(comp+22)))/sqrt(6);</div>
<div class="line">comp[35]=((*(comp+8)) + (*(comp+17)) - 2*(*(comp+23)))/sqrt(6);</div>
<div class="line">comp[36]=(*(comp+4));</div>
<div class="line">comp[37]=(*(comp+18));</div>
<div class="line">comp[38]=(*(comp+19));</div>
<div class="line">comp[39]=(*(comp+20));</div>
<div class="line">comp[40]=(*(comp+2));</div>
<div class="line">comp[41]=(*(comp+12));</div>
<div class="line">comp[42]=(*(comp+13));</div>
<div class="line">comp[43]=(*(comp+14));</div>
<div class="line">comp[44]=(*(comp+1));</div>
<div class="line">comp[45]=(*(comp+9));</div>
<div class="line">comp[46]=(*(comp+10));</div>
<div class="line">comp[47]=(*(comp+11));</div>
<div class="line">comp[48]=sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21))) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21)));</div>
<div class="line">comp[49]=sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21))) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21))) - sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22)) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22));</div>
<div class="line">comp[50]=sqrt(2)*(*(comp+31))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21))) + sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+21))) - 2*sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+23));</div>
<div class="line">comp[51]=-(sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22))) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22));</div>
<div class="line">comp[52]=-(sqrt(2)*(*(comp+31))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22))) + sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+22)) - 2*sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+23));</div>
<div class="line">comp[53]=-2*sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+23));</div>
<div class="line">comp[54]=sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31)) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31));</div>
<div class="line">comp[55]=sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31)) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31)) - sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32))) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32)));</div>
<div class="line">comp[56]=sqrt(2)*(*(comp+31))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31)) + sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+31)) - 2*sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+33));</div>
<div class="line">comp[57]=-(sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32)))) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32)));</div>
<div class="line">comp[58]=-(sqrt(2)*(*(comp+31))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32)))) + sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+32))) - 2*sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+33));</div>
<div class="line">comp[59]=-2*sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+33));</div>
<div class="line">comp[60]=sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41)) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41));</div>
<div class="line">comp[61]=sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41)) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41)) - sqrt(2)*(*(comp+29))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+42)) + sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+42));</div>
<div class="line">comp[62]=sqrt(2)*(*(comp+31))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41)) + sqrt(0.6666666666666666)*(*(comp+35))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+41)) - 2*sqrt(0.6666666666666666)*(*(comp+33))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(1 + (*(u0+43)));</div>
<div class="line">comp[63]=-(sqrt(2)*(*(comp+30))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+42))) + sqrt(0.6666666666666666)*(*(comp+34))*((*(par+17)) + (*(par+16))*(*(u0+0)))*(*(u0+42));</div>
</div><!-- fragment --> </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
